<@sp.pagehead shiroUserHelper.getCurrentShiroUser().parentSources />
<div class="panel panel-inverse" data-sortable-id="form-validation-1">
    <div class="panel-heading">
        <h4 class="panel-title">账户表单</h4>
    </div>
    <div class="panel-body">
        <form class="form-horizontal form-bordered" id="accountEditForm" name="accountEditForm" action="" method="post">
            <div class="form-group">
                <label class="control-label col-md-3 col-sm-3">账户名称</label>
                <div class="col-md-7 col-sm-7">
                    <input type="text" class="form-control" placeholder="账户名称" disabled=""
                           value="${account.accountName}">
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-md-3 col-sm-3">账户编号</label>
                <div class="col-md-7 col-sm-7">
                    <input type="text" class="form-control" placeholder="账户编号" disabled=""
                           value="${account.accountKey}">
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-md-3 col-sm-3">账户密码 *</label>
                <div class="col-md-7 col-sm-7">
                    <input type="password" id="password" class="form-control" name="password"
                           placeholder="密码 6-12位" rangelength="6,12">
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-md-3 col-sm-3">确认密码 *</label>
                <div class="col-md-7 col-sm-7">
                    <input type="password" id="confirmPassword" class="form-control" name="confirmPassword"
                           placeholder="密码 6-12位" rangelength="6,12">
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-md-3 col-sm-3">激活状态</label>
                <div class="col-md-7 col-sm-7">
                    <select class="form-control" name="isActive" id="isActive">
                        <option value="0"
                        <#if account.isActive == 0 > selected</#if> > 未激活</option>
                    <option value="1"
                    <#if account.isActive == 1 > selected
                </#if> >已激活</option>
                </select>
            </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-3 col-sm-3">有效状态</label>
        <div class="col-md-7 col-sm-7">
            <select class="form-control" name="accountStatus" id="accountStatus">
                <option value="0"
                <#if account.accountStatus == 0 > selected</#if>
            >无效</option>
            <option value="1"
            <#if account.accountStatus == 1 > selected
        </#if>
        >有效</option>
        </select>
    </div>
</div>
<!--<div class="form-group">-->
<!--<label class="control-label col-md-3 col-sm-3">所属平台</label>-->
<!--<div class="col-md-7 col-sm-7">-->
<!--<select class="form-control" name="platform" id="platform">-->
<!--<option value="">-&#45;&#45;全平台-&#45;&#45;</option>-->
<!--<#if platforms?has_content && platforms?exists>-->
<!--<#list platforms as pf>-->
<!--<option value="${pf.id}"-->
<!--<#if account.tPlatform.id == pf.id> selected</#if>-->
<!--&gt;${pf.name}</option>-->
<!--</#list>-->
<!--</#if>-->
<!--</select>-->
<!--</div>-->
<!--</div>-->
<div class="form-group">
    <label class="control-label col-md-3 col-sm-3">分配角色</label>
    <div class="col-md-7 col-sm-7">
        <@sp.tree actionUrl="${rc.contextPath}/duty/tree" title="分配角色" selected="${selectedDuties}"/>
    </div>
</div>
<div class="form-group">
    <label class="control-label col-md-3 col-sm-3"></label>
    <div class="col-md-7 col-sm-7">
        <button type="button" id="accountEditSubmitButton" class="btn btn-sm btn-success">提交</button>
        <button type="button" class="btn btn-sm btn-default"
                onclick="getData('${rc.contextPath}/user/query','${shiroUserHelper.getCurrentShiroUser().parentMenuSource.name}')">
            返回
        </button>
    </div>
</div>
</form>
</div>
</div>
<script type="application/javascript">
    $(function () {
        $('#accountEditSubmitButton').click(function () {
            $('#accountEditForm').submit();
        })
        $('#accountEditForm').validate({
            rules: {
                isActive: {
                    required: true
                },
                confirmPassword: {
                    equalTo: "#password"
                },
                accountStatus: {
                    required: true
                }
            },
            errorPlacement: function (error, element) {
                error.appendTo(element.parent());
            },
            submitHandler: function () {
                var selectNode = $.selectedTreeNode();
                postDataByFormParams('${rc.contextPath}/user/edit/${account.id}', '${shiroUserHelper.getCurrentShiroUser().parentMenuSource.name}', 'accountEditForm', selectNode);
            }
        })
    })
</script>